package singleton.fromKanYun.synchronizedSingleton;

/**
 * @Author cyc
 * @Date 2019/4/7/007 23:55
 */
public class SynchronizedSingleton {
    private static SynchronizedSingleton instance = null;

    private SynchronizedSingleton() {
    }

    private static synchronized void syncInit() {
        if (instance == null) {
            instance = new SynchronizedSingleton();
        }
    }

    public static SynchronizedSingleton getInstance() {
        if (instance == null) {
            syncInit();
        }
        return instance;
    }
}
